import { useRoutes, Navigate } from 'react-router-dom'

import Home from '../views/Home'
import Error from '../views/Error'
import City from '../views/City'

const RouterView = () => {
    const routes = useRoutes([
        {
            path: '/',
            element: <Home />,
            children: [
                {
                    path: '/home',
                    element: <Navigate to="/"/>
                }
            ]
        }, {
            path: '/city',
            element: <City />
        }, {
            path: '*',
            element: <Error />
        }
    ])
    return routes
}

export default RouterView
